<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>dept_mag.jsp</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<link rel="stylesheet" type="text/css" href="./css/style.css">

<SCRIPT type="text/javascript">
     function deleteRoom(){
			var id;			
			var c = document.getElementsByName("id");
			var i=0;
			for(i=0;i<c.length;i++){
				if(c[i].checked==true){
					id = c[i].value;
					break;
				}
			}
			if(id==null||id==""){
				alert("请选择后再进行删除操作！");
				return false;
			}else{
				if(confirm("确定要删除吗？")){
				
				 return true;
				}
				return false;
			}
		}

</SCRIPT>
  </head>
  
  <body>
    <div id="blue_button"><div id="blue_button_word">&nbsp;角色管理</div></div>
  <div id="right_background">
  &nbsp;
  <br> <br>
  <form action="role/DelRoleAction" method="post" onsubmit="return deleteRoom()">
  <table  class="tab_dept" border="1" >
  
  <tr class="tab_header">
  <td valign="middle" align="center">角色名称</td>
  <td valign="middle" align="center">权限范围</td>
  <td valign="middle" align="center" width="250px" >具体权限</td>
   <td valign="middle" align="center" >修改</td>
  <td valign="middle" align="center" ></td>
 
  
  </tr>
  <s:iterator var="role" value="rlist">
  
   <tr  class="row2" onMouseOver="this.className='row1'"
			onMouseOut="this.className='row2'">
  <td valign="middle" align="center">${role.RName}</td>
  
  
  <s:if test="#role.RType==1">
   <td valign="middle" align="center">机房管理</td>
  </s:if>
  <s:elseif test="#role.RType==2">
   <td valign="middle" align="center">部门管理</td>
  </s:elseif>
  <s:elseif test="#role.RType==3">
   <td valign="middle" align="center">人员管理</td>
  </s:elseif>
  <s:elseif test="#role.RType==4">
   <td valign="middle" align="center">日志管理</td>
  </s:elseif>
  <s:else>
   <td valign="middle" align="center">权限管理</td>
  </s:else>
  
  <s:if test="#role.RRw==1">
  <td valign="middle" align="center">只有查看权限</td>
  </s:if>
  <s:elseif test="#role.RRw==2">
    <td valign="middle" align="center">可增删改本部门员工</td>
  </s:elseif>
  <s:elseif test="#role.RRw==3">
   <td valign="middle" align="center">所有权限</td>
  </s:elseif>
  <s:else>
   <td valign="middle" align="center">无任何权限</td>
  </s:else>
  
  <td valign="middle" align="center" ><a href="role/ShowEditRoleAction?id=${role.RId}">修改</a></td>
  <td valign="middle" align="center" ><input type="checkbox" id="id" name="id" value="${role.RId}"/></td>
  
  
  </tr>
  </s:iterator>
  </table>
		<br>
         <s:if test="message==1">
		 　 　 　 　  <font color="red">新增成功</font>
		  </s:if>
		  
		   <s:elseif test="message==2">
		   　 　 　 　     <font color="red">删除成功</font>
		  </s:elseif>　
		   <s:elseif test="message==3">
		   　 　 　  <font color="red">修改成功</font>
		  </s:elseif>　
		  <s:elseif test="message==8">
		  <font color="red">　 　  删除失败，存在使用中的角色</font>
		 
		  </s:elseif>
     <p style="margin-right: 100px" align="right">　 　 
		    　 　 　 　 　 　 　  　 　 　 　 　 　 				
		<input type="button" class="del" value=" 新  增 " 　	style="margin-top: 20px;"  onclick="location='jsp/add_role.jsp'"  />	&nbsp; &nbsp;				
		<input type="submit" class="add"  value=" 删  除 " />
	</p>
	</form>
	<p class="paging">
		<s:if test="%{page == 1}">
			&lt;&lt; 首页 &lt; 上一页
		</s:if>
		<s:else>
			<a href="./role/RoleAction?page=1"> &lt;&lt;首页</a>
			<a href="./role/RoleAction?page=${page-1}">&lt; 上一页 </a>
		</s:else>
	
		<strong>第${page}页/共${endpage}页</strong>
		<s:if test="%{page == endpage}">
			下一页 &gt;
			末页 &gt;&gt;
		</s:if>
		<s:else>
			<a href="./role/RoleAction?page=${page+1}"> 下一页 &gt;</a>
			<a href="./role/RoleAction?page=${endpage}">末页 &gt;&gt;</a>
		</s:else>
	</p>
  </div>
  
  </body>
</html>
